package com.zfzs.post.modules.agent.service;

import com.zfzs.post.modules.agent.domain.AgentMoney;
import com.zfzs.post.modules.agent.service.dto.AgentMoneyDTO;
import com.zfzs.post.modules.agent.service.dto.AgentMoneyQueryCriteria;
import com.zfzs.post.modules.agent.domain.AgentMoney;
import com.zfzs.post.modules.agent.service.dto.AgentMoneyDTO;
import com.zfzs.post.modules.agent.service.dto.AgentMoneyQueryCriteria;
import com.zfzs.post.modules.agent.service.dto.AgentMoneyDTO;
import com.zfzs.post.modules.agent.service.dto.AgentMoneyQueryCriteria;
import org.springframework.data.domain.Pageable;

import java.math.BigDecimal;

//import org.springframework.cache.annotation.CacheConfig;
//import org.springframework.cache.annotation.CacheEvict;
//import org.springframework.cache.annotation.Cacheable;

/**
* @author ck
* @date 2019-08-07
*/
//@CacheConfig(cacheNames = "agentMoney")
public interface AgentMoneyService {

    /**
    * queryAll 分页
    * @param criteria
    * @param pageable
    * @return
    */
    //@Cacheable(keyGenerator = "keyGenerator")
    Object queryAll(AgentMoneyQueryCriteria criteria, Pageable pageable);

    /**
    * queryAll 不分页
    * @param criteria
    * @return
    */
    //@Cacheable(keyGenerator = "keyGenerator")
    public Object queryAll(AgentMoneyQueryCriteria criteria);

    /**
     * findById
     * @param id
     * @return
     */
    //@Cacheable(key = "#p0")
    AgentMoney findById(Long id);

    /**
     * create
     * @param resources
     * @return
     */
    //@CacheEvict(allEntries = true)
    AgentMoney create(AgentMoney resources);

    /**
     * update
     * @param resources
     */
    //@CacheEvict(allEntries = true)
    void update(AgentMoney resources);

    /**
     * delete
     * @param id
     */
    //@CacheEvict(allEntries = true)
    void delete(Long id);

    /**
     * 提现
     * @param id 所属人
     * @param money 提现金额
     * @param version 版本号
     */
    int withdrawMoney(Long id, BigDecimal money, Long version);

    /**
     * 新增总余额和可提余额
     * @param agentId
     * @param money
     */
    void addAgentMoney(Long agentId,BigDecimal money);

}